import type { Router, RouteRecord } from "vue-router";

/**
 * 重置 路由
 */
export function resetRouter(router: Router) {
  router.getRoutes().forEach((route: RouteRecord) => {
    const { name } = route;
    if (name && !['404'].includes(name as string)) {
      router.hasRoute(name) && router.removeRoute(name);
    }
  });
}